﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Cost.Models;
using NBlock.MVCExtensions;

namespace Cost.Controllers
{
    public class StockRecordController : Controller
    {
        #region 构造函数
        private readonly ICostRepository<StockRecordView> stockRecordRepository;

        public StockRecordController(ICostRepository<StockRecordView> stockRecordRepository)
        {
            this.stockRecordRepository = stockRecordRepository;
        }
        #endregion

        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public JsonResult List(nbPageInfo pager, nbSearchCondition where)
        {
            var pageData = stockRecordRepository.GetPageable(pager, where);
            var data = pager.ToGridData(pageData);
            return Json(data);
        }

    }
}
